package com.logAndSignProvider.controller;

import com.alibaba.fastjson.JSON;
import com.logAndSignProvider.service.UserService;
import entity.ResponseMessage;
import entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * The type User controller.
 *
 * @author tapoliuliyue
 * @date 2022/04/23
 */
@RestController
@RequestMapping("/user")
@CrossOrigin
public class UserController {
    /**
     * The User service.
     */
    @Autowired
    private UserService userService;

    /**
     * Find all user string.
     *
     * @param user the user
     * @return the string
     */
    @RequestMapping("/findAllUser")
    public String findAllUser(@RequestBody User user) {
        ResponseMessage allUser = userService.findAllUser(user);
        return JSON.toJSONString(allUser);
    }
}
